home *** CD-ROM | disk | FTP | other *** search
- DATAPOOL(5) Last changed: 1-28-99
-
-
- NNAAMMEE
- DDAATTAAPPOOOOLL - Fortran Interprocess Data Sharing
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- This man page describes Fortran datapool usage. The information on
- this man page is intended for use with the MIPSpro Fortran 77
- compiler. The man page can be used as both a quick reference and a
- source of detailed information on datapool usage.
-
- DDaattaappooooll ddeeffiinniittiioonn aanndd ssyynnttaaxx
- The DDAATTAAPPOOOOLL statement is a way for different processes to access the
- same pool of common symbols, or _d_a_t_a_p_o_o_l. Any processes can access
- the shared datapool by linking with the datapool DSO (Dynamic Shared
- Object).
-
- A DDAATTAAPPOOOOLL statement has the following syntax:
-
- DATAPOOL [/[_d_p//]] _n_l_i_s_t [[[[,,]]//[[_d_p]]// _n_l_i_s_t]] ......
-
- where _d_p is the datapool name and _n_l_i_s_t is a list of variable names,
- array names, array declarators, or records. A blank datapool, which
- is unique by itself, is defined by omitting the _d_p argument.
-
- A datapool has similar syntactic form to a common block declaration.
- However, in a common block, the common block variables are associated
- with the same common block declared in other program units by their
- relative position in the common block, regardless of the declared
- symbolic names. In a datapool, the datapool variables are associated
- with declarations in other program units by their symbolic names,
- regardless of the relative order, sizes, and number of variables
- declared in the datapool for that particular program unit. Also, no
- datapool variables can be initialized with a DDAATTAA statement.
-
- DDaattaappooooll UUssaaggee
- Follow these steps to use datapools:
-
- 1. Put each blockdata containing one or more datapool definitions in a
- Fortran source file.
-
- 2. Compile the Fortran source file to create the object file (..oo file)
- using the --GG00 option.
-
- 3. Run the lldd command:
-
- ld -soname _d_p_f..ssoo --sshhaarreedd --nnooiivvppaadd --GG00 --oo _d_p_f..ssoo --iinniitt __iinniitt__ddpp___d_p_f__
- --ffiinnii __uunnmmaapp__ddpp____ _d_p_f..oo
-
- where _d_p_f is the name of the Fortran source file without the ..ff
- extension. This creates the datapool DSO file ddppff..ssoo.
-
- 4. Compile the rest of the Fortran program with the --GG00 option.
-
- 5. Link all the Fortran objects with the selected datapool DSO's. The
- ..o files created from the datapool source files do need to be
- linked to create the executable.
-
- 6. When the program is run, the default directory for the shared
- mapped data is //uussrr//ttmmpp. The user can change this by setting the
- DDAATTAAPPOOOOLL__DDIIRR environment variable to point to the desired
- directory.
-
- DDaattaappooooll DDeettaaiillss
- Each datapool item, when compiled, is turned into a separate external
- symbol so it can be correctly associated with the same symbol declared
- in other program units without being affected by its relative order in
- the datapool.
-
- In one blockdata subprogram, and in only one, a datapool must be
- defined as to its exact number of items, sizes, and relative order.
- This will be used as the basis for sharing the datapool with other
- processes wishing to access the same data.
-
- Each blockdata can contain definitions for one or more datapools.
- However, each Fortran source file can contain only one such blockdata.
- Each of those source files is turned into a DSO which any program can
- link to if the datapools defined in that blockdata need to be
- accessed. In other words, all datapools defined in a single blockdata
- always go together as a single shared unit. If you want to choose the
- datapools separately, they have to be defined in different blockdata,
- and put into separate Fortran source files.
-
- All datapool variables defined in the blockdata are mapped to a data
- file which is shared between different processes. The name of the
- mapped data file is the name of the corresponding Fortran source files
- preceded by DDPP__. This file is put into the //uussrr//ttmmpp// directory as the
- default, but this default directory can be changed with the
- DDAATTAAPPOOOOLL__DDIIRR environment variable. For example, datapools //aa//, //bb//,
- and //cc// are defined in blockdata ddpp__aabbcc__ddeeff which is in the Fortran
- source file ddppaabbcc..ff. After compilation, the file ddppaabbcc..ff is
- converted into ddppaabbcc..ssoo which an application can link with to share
- the datapools //aa//, //bb//, and //cc//. At runtime, a mapped data file,
- //uussrr//ttmmpp//DDPP__ddppaabbcc, is created as the default.
-
- After all processes sharing this mapped datapool have terminated, the
- mapped file is removed automatically. However, if for any reason a
- process using the datapool aborts abnormally before it can run to
- completion, then the mapped file remains and the user must remove the
- file; otherwise, the next fresh process using the datapool will pick
- up the values that have been mapped into that file.
-
- NNOOTTEESS
- * The following lines can be added to the MMAAKKEEFFIILLEE to create a
- datapool DSO from the Fortran source file:
-
- .SUFFIXES : .so
- FFLAGS = -G 0
- LDFLAGS = -G 0
- .f.so:
- $(FC) $(FFLAGS) -c $*.f
- $(LD) $(LDFLAGS) -soname $@ -shared -noivpad -o $@ \
- -init _init_dp_$*_ -fini _unmap_dp__ $*.o
-
- * For applications which rely on datapool variables being set to
- zeroes at the beginning of execution, it is prudent to check for the
- existence of the mapped data files //uussrr//ttmmpp//DDPP__**, which might remain
- after an abnormal termination in previous runs.
-
- * Programs running on different machines can share datapools across
- NFS by setting DDAATTAAPPOOOOLL__DDIIRR to point to the same physical directory.
- However, because I/O operations are buffered across NFS, changing a
- datapool variable on one system does not cause the new value to be
- written immediately in the data file and so it is not known by a
- different process on another system. It will be up to the user to
- create his own datapool status variable to ensure the update of the
- datapool variables by another process on a different system.
-
- * At runtime, the datapool DSOs must be in the search path of rrlldd for
- them to be found. The default search path can be changed by setting
- the environment variable LLDD__LLIIBBRRAARRYY__PPAATTHH.
-
- * The datapool DSOs cannot be used with IRIX releases before 5.1.1.
- You receive an error message that the DSO's are not found when a
- datapool application is run on those releases even when the DSOs
- exist.
-
- EEXXAAMMPPLLEESS
- ::::::::::::::
- testdp.f
- ::::::::::::::
- C
- C NAME
- C testdp.f - Shared DATAPOOL test case
- C
- C Note that both the sizes and the relative order of the datapool
- C items are different from the defined sizes and order in the
- C blockdata
-
- datapool /hello/ c, b, arr(100,100,3)
- real*8 arr
-
- print *, 'Read arr(1,1,1)', arr(1,1,1)
- if (arr(1,1,1) .ne. 42) then
- arr(1,1,1) = 42
- endif
-
- print *, "Address Offset = ", %loc(b)-%loc(arr), %loc(c) -%loc(b)
- call sleep(10)
- end
-
- ::::::::::::::
- hello.f
- ::::::::::::::
- blockdata hellodef
- C The relative positions and sizes of the datapool items are
- C defined in this blockdata and nowhere else.
- real*8 arr
- datapool /hello/ arr(100,100,30), b, c
- end
-
- ::::::::::::::
- Makefile
- ::::::::::::::
- .SUFFIXES : .so
- CFLAGS = -G 0
- FFLAGS = -G 0
- FFILES = testdp.f hello.f
-
- default: testdp
-
- testdp: testdp.o hello.so
- $(FC) $(FFLAGS) -o testdp testdp.o hello.so
-
- .f.so:
- $(FC) $(FFLAGS) -c $*.f
- $(LD) -soname $@ -shared -noivpad $*.o -G 0 -o $@ \
- -init _init_dp_$*_ -fini _unmap_dp__
-
- test: default
- testdp &
- @ sleep 1
- testdp &
-
- clean:
- rm -f *.o core a.out *.so
-
- clobber: clean
- rm -f testdp so_locations
-
- SSEEEE AALLSSOO
- ff7777(1), ddssoo(5), lldd(1), rrlldd(1)
-
- _M_I_P_S_p_r_o _F_o_r_t_r_a_n _7_7 _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
-
- This man page is available only online.
-